import Vue from 'vue'
import Vuex from 'vuex'
import Storage from "@/uitl/StorageHandle"; //sessionStorage的操作

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userinfo: Storage.getItem("userinfo") || "",
    comname: "Login",
    festivalListData: {},
    festivalListDatas: [],
  },
  mutations: {
    Change(state, data) {
      state.comname = data.name
      state.festivalListDatas.forEach(item => {
        if (item.id == data.id) {
          state.festivalListData = item
        }
      });
    },
    SaveUserInfo(state, data) {
      Storage.setItem(`userinfo`, data);
      state.userinfo = data;
    }
  },
  actions: {
  },
  modules: {
  }
})
